# -*- coding: utf-8 -*-
import os

from PyQt5 import QtCore, QtGui, QtWidgets, sip
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QDockWidget, QAction, QFileDialog
import cv2
from module.notch.notchGui import *
from moduleManager import *

GAP_PATH = os.path.dirname(__file__)


class Notch(object):
    def __init__(self):
        super().__init__()
        self.__class__.Icon = os.path.join(GAP_PATH, "icons")
        self.__class__.MenuText = "notch"
        self.__class__.ToolTip = "a notch search workbench"

    def setPlatform(self, platform):
        self.platform = platform

    def Initialize(self, index, para):
        if self.platform is None:
            return
        self.app = notchGui()
        self.app.initUI()
        self.app.setPara(index, para)
        self.app.update_para_signal.connect(self.platform.updateRunPara)
        self.platform.centralWidget.zone_signal.connect(self.app.zoneChange)
        self.platform.moduleWidget.setWidget(self.app)

    def initRunEnv(self):
        self.app = notchGui()
        self.app.update_signal.connect(self.platform.updateImage)

    def run(self, para):
        self.app.run(para)


def getModuleClass():
    return Notch
